package o;

import android.widget.TabHost.TabSpec;
import androidx.fragment.app.Fragment;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appgallery.foundation.service.common.protocol.request.AppListFragmentRequest;
import com.huawei.appgallery.foundation.ui.framework.uikit.ContractFragment;
import com.huawei.appgallery.purchasehistory.api.AppTracesListFragmentProtocol;
import com.huawei.appgallery.purchasehistory.api.AppTracesListFragmentProtocol.Request;
import java.util.List;

public class cte extends ewk {
    private boolean ˊ;
    private List<dgp> ˋ;

    public cte(List<dgp> list) {
        this.ˋ = list;
    }

    public void ˏ(boolean z) {
        this.ˊ = z;
    }

    public int ˎ() {
        return this.ˋ.size();
    }

    public Fragment ˎ(int i) {
        String userId = UserSession.getInstance().getUserId();
        AppTracesListFragmentProtocol appTracesListFragmentProtocol = new AppTracesListFragmentProtocol();
        AppListFragmentRequest request;
        ContractFragment contractFragment;
        switch (i) {
            case 0:
                request = new Request();
                request.ॱ(0);
                request.ˋॱ(userId);
                request.ʽ(false);
                appTracesListFragmentProtocol.ˏ(request);
                contractFragment = (ContractFragment) cjk.ˎ().ˊ(new cjm("apptraceallmultilist.fragment", (cjo) appTracesListFragmentProtocol));
                if (contractFragment == null) {
                    return new ContractFragment();
                }
                return contractFragment;
            case 1:
                request = new Request();
                request.ॱ(1);
                request.ˋॱ(userId);
                request.ʽ(true);
                appTracesListFragmentProtocol.ˏ(request);
                contractFragment = (ContractFragment) cjk.ˎ().ˊ(new cjm("apptraceuninstallmultilist.fragment", (cjo) appTracesListFragmentProtocol));
                if (contractFragment == null) {
                    return new ContractFragment();
                }
                return contractFragment;
            case 2:
                return ˊ(appTracesListFragmentProtocol);
            default:
                return new ContractFragment();
        }
    }

    private ContractFragment ˊ(AppTracesListFragmentProtocol appTracesListFragmentProtocol) {
        AppListFragmentRequest request = new Request();
        request.ॱ(2);
        appTracesListFragmentProtocol.ˏ(request);
        ContractFragment contractFragment = (ContractFragment) cjk.ˎ().ˊ(new cjm("familysharemember.fragment", (cjo) appTracesListFragmentProtocol));
        if (contractFragment == null) {
            return new ContractFragment();
        }
        return contractFragment;
    }

    public void ˏ(int i, Fragment fragment, Fragment fragment2) {
        if (fragment instanceof ciy) {
            ciy o_ciy = (ciy) fragment;
            if (this.ˊ) {
                o_ciy.ˋ(i);
            } else {
                o_ciy.ʽˊ();
            }
        }
        if (fragment2 instanceof ciy) {
            ((ciy) fragment2).ʽˊ();
        }
    }

    public boolean ˎ(int i, TabSpec tabSpec) {
        if (CollectCheck.isEmpty(this.ˋ)) {
            Logger.e("PurchaseMultiTabsAdapter", "empty tabItemList. createTabSpec position = " + i);
            return false;
        } else if (((dgp) this.ˋ.get(i)) == null) {
            return false;
        } else {
            tabSpec.setIndicator(((dgp) this.ˋ.get(i)).ˊ());
            return true;
        }
    }

    public String ˊ(int i) {
        if (CollectCheck.isEmpty(this.ˋ)) {
            Logger.e("PurchaseMultiTabsAdapter", "empty tabItemList. getTabSpecTag position = " + i);
            return String.valueOf(i);
        } else if (((dgp) this.ˋ.get(i)) == null) {
            return String.valueOf(i);
        } else {
            return ((dgp) this.ˋ.get(i)).ˏ();
        }
    }
}
